package com.util.aliOSS;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.BucketInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This sample demonstrates how to upload/download an object to/from
 * Aliyun OSS using the OSS SDK for Java.
 */
public class OSSFather {
    static Logger logger = LoggerFactory.getLogger(OSSFather.class);
      static String endpoint = "http://oss-cn-beijing.aliyuncs.com";
      static String accessKeyId = "LTAI12tJ9yxQmJ2H";
      static String accessKeySecret = "YK5DOThA33XSVXLfWlq5eyF7PxoAPs";
      public static final String bucketName = "ziyitest";
    /**
     * OSS的文件夹名
     */
      static String folder = "imageserver/";//这里是你存放图片的文件夹名
      static String key = "http://ziyitest.oss-cn-beijing.aliyuncs.com/";
      static String last = "?x-oss-process=image/resize,w_300,h_300/quality,q_50";

            OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
    public OSSFather(){
        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
        if (ossClient.doesBucketExist(bucketName)) {
            logger.debug("您已经创建Bucket：" + bucketName + "。");
        } else {
            logger.debug("您的Bucket不存在，创建Bucket：" + bucketName + "。");
            ossClient.createBucket(bucketName);
        }
        BucketInfo info = ossClient.getBucketInfo(bucketName);
        logger.debug("Bucket " + bucketName + "的信息如下：");
        logger.debug("\t数据中心：" + info.getBucket().getLocation());
        logger.debug("\t创建时间：" + info.getBucket().getCreationDate());
        logger.debug("\t用户标志：" + info.getBucket().getOwner());

    }

}